<template>
	<view>
		<van-nav-bar title="我的关注" left-text="返回" left-arrow @click-left="onClickLeft" />
		<view class="box">
			<view v-show="Pitera" style="margin: 100px auto;">
				<van-empty description="暂无关注" />
			</view>
			<view style="display: flex;width: 710rpx;margin-left: 20rpx;align-items: center;margin-top: 30rpx;"
			v-for="(item,index) in Attention" :key="index">
				<view @click="OthersData(item.beFocuson)">
					<img style="width: 120rpx;height: 120rpx;border-radius:100% ;"
					 :src="item.userPhoto" alt="">
				</view>
				<view style="margin-left: 20rpx;width: 430rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
					<view style="font-weight: bold;">
						昵称：{{item.userName}}
					</view>
					<view style="color: gray;">
						注册日期：{{item.registrationTime}}
					</view>
					<view style="color: gray;">
						手机号：{{item.userTel}}
					</view>
				</view>
				<view style="border: 1px solid cadetblue;height: 50rpx;
				line-height: 50rpx;font-size: 27rpx;margin-left: 30rpx;border-radius:10%;color: orange;"
				@click="unfollow(item.attentionId)">
					取消关注
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../com/request.js'
	export default {
		data() {
			return {
				Attention:[],
				Pitera:true
			}
		},
		methods: {
			onClickLeft() {
				uni.redirectTo({
					url: '/pages/MyCenter/MyCenter'
				});
			  },
			unfollow(attentionId){
				let that=this
				request({
					url:'api/unfollow/get',
					methods:'get',
					data:{
					  attentionId:attentionId
					},
					success: (resp) => {
						that.selectAttention()
					}
				})
			},
			selectAttention(){
				request({
						url:'api/Attention/get1',
						methods:'get',
						data:{
						  acc:uni.getStorageSync("userTel")
						},
						success: (resp) => {
							this.Attention=resp.data.data
							if(this.Attention.length>0){
								this.Pitera=false
							}else{
								this.Pitera=true
							}
							console.log(this.Attention,52);
						}
					})
			},
			OthersData(beFocuson){
				uni.setStorageSync("attention", beFocuson)
				uni.redirectTo({
					url: '/pages/OthersData/OthersData'
				});
			}
		},
		onLoad(){
			this.selectAttention()
		}
	}
</script>

<style>

</style>
